const { orderFormatError } = require("../constant/error.type")

const orderValidator = (rules) => {
  return async (ctx, next) => {
    try {
      ctx.verifyParams(rules)
    } catch (error) {
      orderFormatError.result = error
      return ctx.app.emit('error', error, ctx)
    }
    await next()
  }
}
module.exports = {
  orderValidator
}